import txios from '../../index'
import { IDataType } from '../../types'
import { ElMessage } from 'element-plus'
export function getStoryList(url: string, queryInfo: any) {
  return txios.post<IDataType>({
    url: url,
    data: queryInfo,
    interceptorHooks: {
      responseInterceptor: (res) => {
        return res.data
      }
    }
  })
}

export function setStoryList(url: string, queryInfo: any) {
  return txios.post<IDataType>({
    url: url,
    data: queryInfo,
    interceptorHooks: {
      responseInterceptor: (res) => {
        if (res.data.code === 0) {
          ElMessage({
            showClose: true,
            message: '      🚀添加故事集成功🚀',
            type: 'success',
            center: true
          })
        }
        return res.data
      }
    }
  })
}
